package com.zmn.plat.common.dictionary;

import lombok.Getter;

/**
 * 描述: 白名单类型
 *
 * @author jiafei
 * @version 1.0
 * @since 2021/9/14 15:06
 */
public enum WhitelistUserTypeEnum {

	/**
	 * 描述: 员工白名单
	 */
	STAFF_WHITELIST(1, "员工白名单"),

	/**
	 * 描述: 工程师白名单
	 */
	MASTER_WHITELIST(2, "工程师白名单"),
	;

	@Getter
	private Integer code;

	@Getter
	private String name;

	WhitelistUserTypeEnum(Integer code, String name) {

		this.code = code;
		this.name = name;
	}

	public static WhitelistUserTypeEnum of(Integer code) {

		if (code == null) {
			return null;
		}
		switch (code) {
			case 1:
				return STAFF_WHITELIST;
			case 2:
				return MASTER_WHITELIST;
			default:
				return null;
		}
	}

	public static String getName(Integer code) {

		WhitelistUserTypeEnum of = of(code);
		return of == null ? null : of.getName();
	}
}
